//
// Created by Administrator on 2020/7/9.
//T5章:数组、指针与字符串
//实验六
//2.声明一个Employee类,其中包括姓名,街道地址、城市、邮编等属性,以及change_name()
//和display()等函数。display()显示姓名、街道地址、城市和邮编等属性;
//change_name()改变对象的姓名属性,实现并测试这个类。

//-------------employee.h--------------//
#ifndef EMPLOYEE_H_
#define EMPLOYEE_H_

#include <iostream>
using namespace std;
class Employee
{
    char* name;
    char* address;
    char* city;
    char* code;
public:
    Employee(char* n="",char* add="",char* ct="",char* cd=""):name(n),
    address(add),city(ct),code(cd){}

    void display()
    {
        cout<<"name:"<<name<<endl;
        cout<<"address:"<<address<<endl;
        cout<<"city:"<<city<<endl;
        cout<<"code:"<<code<<endl;
    }
    void change_name(char* nm)
    {
        name=nm;
    }
};

#endif

//-------------main.cpp--------------//
/*
#include <stdafx.h>
#include <iostream>
#include "employee.h"
using namespace std;

int main()
{
    Employee e("Wang Er,Haidian","Beijing","100084");
    e.display();
    e.change_name("Li San");
    e.display();
    return 0;
}
*/




